const events = require("events");

// console.log(events);

const EventEmitter = new events.EventEmitter();

//监听事件
EventEmitter.on("click", function (data) {
    console.log(data);
});

//触发事件
setTimeout(function () {
    EventEmitter.emit("click", "发送的数据");
}, 1000);